<link rel="stylesheet" type="text/css" href="/assets/css/tableform.css">
<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="inventory/material/addMaterialList">
    <label class="control-label label">
			<a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}"
				onclick="window.location.reload()"><i class="fa fa-refresh"></i> </a>
	</label>
    <div class="form-group">
        <label class="control-label  col-sm-1">{:__('Warehouse')}:</label>
        <div class="col-xs-12 col-sm-2">
        	<!-- <input id="c-warehouse_id" data-rule="required" data-source="information/warehouse/index" 
        	class="form-control selectpage text-center numstyle" placeholder="请选择仓库" name="row[warehouse_id]" 
        	type="text" value="2" style="width:150px" > -->
        	{:build_select('row[warehouse_id]',$warehouse_arr,2,['style'=>"width:150px",'id'=>'c-warehouse_id'])}
        </div>
        <label class="control-label col-xs-12 col-sm-1">{:__('Order_date')}:</label>
        <div class="col-xs-12 col-sm-2">
        	<input id="c-code_date" class="form-control datetimepicker" data-date-format="YYYY-MM-DD" 
        	data-use-current="true" data-rule="required" name="row[code_date]" type="text" 
        	value="{:date('Y-m-d')}" style="width:150px">
        </div>
        <label class="control-label col-xs-12 col-sm-1">{:__('Code')}:</label>
        <div class="col-xs-12 col-sm-2">
        	<input id="c-code" readonly data-rule="required" class="form-control" 
        	name="row[code]" type="text" value="{$code}" style="width:180px">
        </div>
        
        <!-- 领料人 -->
        <input class="hidden" id="user_id" name="row[user_id]" value="">
		<input class="hidden" id="user_name" name="row[user_name]" value="">
		<input class="hidden" id="dept_name" name="row[dept_name]" value="">
		<input class="hidden" id="dept_id" name="row[dept_id]" value="">
		<input class="hidden" id="oa_item_name" name="row[oa_item_name]" value="">
		<!-- 领料人 -->
    </div>
    
    
    <div class="form-group">
    	
    	<label class="control-label col-xs-12 col-sm-1">{:__('OA_citem_type')}:</label>
        <div class="col-xs-12 col-sm-2">
        	{:build_select('row[oa_citem_type]',$oa_citem_arr,[],['style'=>"width:150px",'id'=>'oa_citem_type','onchange'=>"changeItemName()"])}
        </div>
        <label class="control-label col-xs-12 col-sm-1">{:__('OA_item_name')}:</label>
        <div class="col-xs-12 col-sm-2">
        	<input id="oa_item_name_id" data-source="inventory/material/getoaitemname" 
        	class="form-control selectpage text-center numstyle" placeholder="请选择项目" name="row[oa_item_name_id]" 
        	data-field="field_3" data-primary-key="data_id" data-order-by="field_3"
        	type="text" style="width:400px" data-select-only="true" >
        </div>
       
       <!-- <div class="col-xs-12 col-sm-2"></div> -->
    </div>
    
    <div class="form-group">
    	<label class="control-label col-xs-12 col-sm-1">{:__('OA_type')}:</label>
        <div class="col-xs-12 col-sm-2">
        	{:build_select('row[oa_type]',$oa_type_arr,[],['style'=>"width:150px",'id'=>'oa_type'])}
        </div>
    	<label class="control-label col-xs-12 col-sm-1">{:__('Remark')}:</label>
        <div class="col-xs-12 col-sm-2">
        	<input class="form-control" name="row[remark]" type="text" style="width:400px">
        </div>
    </div>

    <div style="white-space: nowrap;overflow-x: auto;width:100%">
        <table class="table fieldlist table-nowrap" data-template="basictpl" id="free-programme-item-table" data-name="row[basic]">
            <tr class="table-bordered">
            	<td class="text-center table-bordered" width="100">{:__('物料图片')}</td>
                <td class="text-center table-bordered" width="100">{:__('物料编码')}</td>
                <td class="text-center table-bordered" width="200">{:__('物料名称')}</td>
                <td class="text-center table-bordered" width="150">{:__('规格型号')}</td>
                <td class="text-center table-bordered" width="100">{:__('单位')}</td>
                <td class="text-center table-bordered" width="100">{:__('库存')}</td>
                <td class="text-center table-bordered" width="100">{:__('数量')}</td>
                <td class="text-center table-bordered" width="40">{:__('操作')}</td>
            </tr>
        </table>
    </div>
    <textarea name="row[basic]" id="c-basic-textarea" class="form-control hidden" cols="30" rows="5">{$list_json}</textarea>
    <script id="basictpl" type="text/html">
        <tr class="table-bordered">
			<td class="text-center table-bordered">
				<a href="javascript:void(0)">
					<img class="img-sm img-center" src="<%=value['image_url']==''?'/uploads/nopic.png':value['image_url']%>" style="width:50px;height:50px" data-image-show></td>
				</a>
            <td class="text-center table-bordered">
                <%=value?value['number']:''%>
				<input class="hidden" name="<%=name%>[<%=index%>][inv_id]" value="<%=value?value['inv_id']:''%>">
				<input class="hidden" name="<%=name%>[<%=index%>][number]" value="<%=value?value['number']:''%>">
            </td>
            <td class="text-center table-bordered">
				<%=value?value['name']:''%>
			</td>
            <td class="text-center table-bordered">
				<%=value?value['specification']:''%>
			</td>
			<td class="text-center table-bordered">
                <%=value?value['unit']:''%>
            </td>
			<td class="text-center table-bordered">
                <%=value?value['iQuantity']:''%>
            </td>
            <td class="text-center table-bordered">
                <input type=number  style="width:150px;"  name="<%=name%>[<%=index%>][nums]"  value="<%=value?value['nums']:''%>" class="form-control numstyle" data-rule="required;range(0~<%=value?value['iQuantity']:''%>)"></td>
            </td>
            <td class="text-center"><span class="btn btn-sm btn-danger btn-remove"><i class="fa fa-times"></i></span></td>
        </tr>
    </script>
    <div class="form-group layer-footer">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-12 text-center">
            <button type="button" class="btn btn-primary btn-embossed" id="tosubmit">点击提交</button>
            <button type="button" class="btn btn-danger btn-embossed" id="toclear">清空记录</button>
            <button type="button" class="btn btn-default btn-embossed " id="toclose">关闭窗口</button>
        </div>
    </div>
</form>
<style>

.img-sm, .box-comments .box-comment img, .user-block.user-block-sm img {
    width: 70px !important;
    height: 70px !important;
	border-radius: 5px;
}
.inputNum{
	display:flex;
	justify-content: space-between;
}
.label{
	position: absolute;
	left: 25px;
	top:8px;
}
div.sp_result_area.shadowDown{
    width:auto
}
</style>
